#include "httpserver.h"

#include <QTcpSocket>
#include <QUrl>

#include "collection/collection.h"

using namespace Playur;

HttpServer::HttpServer()
{
    connect(this, SIGNAL(newConnection()), this, SLOT(handleNewConnection()));
}

void HttpServer::handleNewConnection()
{
    Connection* c = new Connection(this, nextPendingConnection());
    c->handle();
}

void HttpServer::setCollection(Collection* c)
{
    _collection = c;
}

Collection* HttpServer::collection()
{
  return _collection;
}

const QString& HttpServer::xml()
{
  return _collection->xml();
}
